﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>xPath</title>
    <script language="javascript" type="text/javascript" src="../jslib/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../jslib/prototype.js"></script>
    <script language="javascript" type="text/javascript" src="../jslib/ext.js"></script>
    <script language="javascript" type="text/javascript" src="../jslib/xpath.js"></script>
    <script language="javascript" type="text/javascript">
        $(function(){
        $.ajax({
             type: "GET",
             url: "../temp/qqmenu.xml?" + new Date().getTime(), 
            dataType: "xml",
            success:test 
        });
    });
    
    function test(xml){
        var ns = $(xml).selectNodes('menus/menu');
        var a = [];
//        for (var i = 0, l = ns.length; i < l; i++){
//            a.push($(ns[i]).attr('name'));
//        }
        ns.each(function(){
        a.push($(this).attr('name'));
        })
        
        $("#res").html(a.join(','));
    }
    
    $(function(){
        var doc = $.getXmlDoc();
        doc.loadXML('<div id="res"></div>');
        var d = doc.documentElement;
    });
    </script>
</head>
<body>
<div id="res"></div>
</body>
</html>
